package com.cloud.sample.consumer.core.http;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

/**
 * @author gjy
 * @since 2021/7/1 0001
 */
public abstract class BaseResponse implements Serializable {

    private static final long serialVersionUID = -1L;

    protected Integer code;
    protected String message;
    protected Long timestamp;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected Integer errorCode;

    public BaseResponse(String message) {
        this.code = code;
        this.message = message;
        this.errorCode = errorCode;
    }

    public BaseResponse(Integer code, String message) {
        this.code = code;
        this.message = message;
        this.errorCode = errorCode;
    }

    public BaseResponse(Integer code, String message, Integer errorCode) {
        this.code = code;
        this.message = message;
        this.errorCode = errorCode;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public Long getTimestamp() {
        timestamp = System.currentTimeMillis();
        return timestamp;
    }
}
